<template>
  <view class="box">
    <view class="main">
			<view style="margin-top: 0px;">
				<text>年龄：</text>{{datas.age}}
			</view>
			<view>
				<text>主管医生：</text>{{datas.main}}
			</view>
			<view>
				<text>就诊地址：</text>{{datas.address}}
			</view>
			<view>
				<text>随访方式：</text>{{datas.manner | mannerFlag}}
			</view>
			<view>
				<text>是否本人到访：</text>{{datas.person | personFlag}}
			</view>
			<view>
				<text>下次是否继续随访：</text>{{datas.followFlag == 1 ? '是' : '否'}}
			</view>
			<view style="color: crimson;">
				<text>下次随访时间：</text>{{datas.nextFollow | followFlag}}
			</view>
			<view>
				<text>指导意见：</text>{{datas.opinion}}
			</view>
			<view>
				<text>处理情况：</text>{{datas.handling}}
			</view>
    </view>
  </view>
</template>

<script>
	import { getTime } from '../../common/tool.js'
	
	export default {
		data() {
			return {
				datas: ''
			}
		},
		async mounted() {
			let openid = uni.getStorageSync('openid') //获取保存的身份信息
			let code = JSON.stringify("'" + openid + "'")
			
			const { data: res } = await this.$http.get(`/manage/getRecord?phone=${code}`)
			this.datas = res
		},
		filters: {
			mannerFlag: function(item) {
				if(item == 1) {
					return '电话'
				} else if(item == 2) {
					return '上门'
				} else if(item == 3) {
					return '书面'
				}
			},
			personFlag: function(item) {
				if(item == 1) {
					return '本人'
				} else if(item == 2) {
					return '亲属'
				}
			},
			followFlag: function(item) {
				return getTime.getTime(item)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		position: relative;
		width: 100%;
		height: 667px;
		background: linear-gradient(#9ACDE2, #f1f1f1);
		.main {
			position: relative;
			top: 20px;
			background-color: #fff;
			width: 90%;
			height: 80%;
			margin: auto;
			border-radius: 10px;
			padding: 20px;
			box-sizing: border-box;
			text {
				font-weight: 700;
			}
			>view {
				margin-top: 20rpx;
			}
		}
	}
</style>